<script setup lang="ts">
import menu_collapse from '@/components/menu_collapse.vue';
import { Expand,Fold } from '@element-plus/icons-vue';
import { ref,computed } from 'vue';

const asideWidth = ref('');
const collapsed = ref<boolean>(false);

const AutoAsideWidth = computed(() => {
    if(collapsed.value){
        return '64px'
    } else {
        return '200px'
    }
})
</script>


<template>
    <div class="common-layout">
        <el-container>
            <el-aside :style="'width:' + AutoAsideWidth"><menu_collapse :collapsed="collapsed"></menu_collapse></el-aside>
            <el-container>
                <el-header>
                    <el-icon style="font-size: 30px;" @click="() => {collapsed = !collapsed}">
                        <component :is="collapsed ? Expand:Fold"></component>
                    </el-icon>
                </el-header>
                <el-main>
                    <RouterView/>
                </el-main>
                <el-footer>Footer</el-footer>
            </el-container>
        </el-container>
    </div>
</template>

<style lang="less">
.common-layout {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.el-container {
    height: 100%;
}
.el-header,
.el-footer {
    background-color: #B3C0D1;
    color: #333;
    // text-align: center;
    line-height: 80px;
}

.el-aside {
    background-color: @menuBg;
    color: #333;
    text-align: center;
    /* line-height: 200px; */
    overflow: hidden;
}

.el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    /* line-height: 160px; */
}
</style>